package org.sport.model.entityModel;

import javax.persistence.*;

/**
 * Created by Allen on 2017/9/29.
 */
@Entity
@Table(name = "awardtable", schema = "sportinfo", catalog = "")
public class AwardtableEntity {
    private int id;
    private Integer tot;
    private UsertableEntity usertableByUserId;

    @Id
    @Column(name = "_id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "tot", nullable = true)
    public Integer getTot() {
        return tot;
    }

    public void setTot(Integer tot) {
        this.tot = tot;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AwardtableEntity that = (AwardtableEntity) o;

        if (id != that.id) return false;
        if (tot != null ? !tot.equals(that.tot) : that.tot != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (tot != null ? tot.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "userId", referencedColumnName = "_id")
    public UsertableEntity getUsertableByUserId() {
        return usertableByUserId;
    }

    public void setUsertableByUserId(UsertableEntity usertableByUserId) {
        this.usertableByUserId = usertableByUserId;
    }
}
